# Maintainer: NicoHood <archlinux {cat} nicohood {dog} de>
# PGP ID: 97312D5EB9D7AE7D0BD4307351DAE9B7C1AE9161
# Contributor: Morgenstern <charles [at] charlesbwise [dot] com>

pkgname=cherrytree
pkgver=0.99.54
pkgrel=1
pkgdesc="Hierarchical note-taking application"
arch=('loong64' 'x86_64')
url="https://www.giuspen.com/cherrytree/"
license=('GPL3')
depends=('fmt' 'gspell' 'gtksourceviewmm' 'libxml++2.6' 'uchardet' 'vte3')
makedepends=('cmake' 'python' 'spdlog')
checkdepends=('xorg-server-xvfb')
source=("${pkgname}-${pkgver}.tar.xz::https://www.giuspen.com/software/${pkgname}_${pkgver}.tar.xz"
        "${pkgname}-${pkgver}.tar.xz.asc::https://www.giuspen.com/software/${pkgname}_${pkgver}.tar.xz.asc")
sha512sums=('c4e8ff4440fc688ee6b24279857452e00f85614dcf094b311a768479fcc842712171e4dcd0b121b865aedd2d854ed5906e7fc615a69a76d50af71b91bb29835e'
            'SKIP')
validpgpkeys=('C7BF38CE0BD442C2369AA984049128A20CE0648D') # Giuseppe Penone <giuspen [at] gmail [dot] com>

build() {
  cmake -B build -S "${pkgname}_${pkgver}" \
  -DINSTALL_GTEST:BOOL='OFF' \
  -DAUTO_RUN_TESTING:BOOL='OFF' \
  -DCMAKE_BUILD_TYPE='None' \
  -DCMAKE_INSTALL_PREFIX='/usr' \
  -Wno-dev
  cmake --build build
}

check() {
  xvfb-run build/run_tests_with_x_1
  xvfb-run build/run_tests_with_x_2
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
